package com.bah.tract.client.ui.menu;

import java.awt.Component;
import java.awt.MenuItem;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.inject.Inject;

import com.google.inject.name.Named;

public class SubmitTimeMenuItem extends MenuItem {

	private static final class SubmitTimeActionListener implements
			ActionListener {
		private final Component tolDialog;
		private final Component jiraDialog;
		private Component projectDialog;

		private SubmitTimeActionListener(Component tolDialog,
				Component jiraDialog, Component projectDialog) {
			this.tolDialog = tolDialog;
			this.jiraDialog = jiraDialog;
			this.projectDialog = projectDialog;
		}

		@Override
		public void actionPerformed(final ActionEvent e) {
			tolDialog.setVisible(true);
			jiraDialog.setVisible(true);
			projectDialog.setVisible(true);
		}
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Inject
	public SubmitTimeMenuItem(@Named("tolDialog") final Component tolDialog,
			@Named("jiraDialog") final Component jiraDialog,
			@Named("projectDialog") final Component projectDialog) {
		super("Submit Time");
		addActionListener(new SubmitTimeActionListener(tolDialog, jiraDialog,
				projectDialog));
	}
}
